/*	Problem: http://codeforces.ru/problemset/problem/100/I
	  Verdict: Accepted
*/
int main() {
  string line = Stdio.stdin->gets();
  float deg, x, y;
  sscanf(line, "%f", deg);
  float rad = deg * Math.pi / 180;
  line = Stdio.stdin->gets();
  sscanf(line, "%f %f", x, y);
  float xx = x * cos(rad) - y * sin(rad);
  float yy = x * sin(rad) + y * cos(rad);
  write(sprintf("%f %f\n", xx, yy));
}